package com.xjggb.栈;

public class Stack<E> {
    private com.xjggb.栈.List<E> list=new com.xjggb.栈.ArrayLIst<E>();
    public void clear() {
        list.clear();
    }

    public int size() {
        return list.size();
    }

    public boolean isEmpty() {
        return list.isEmpty();
    }

    /*
    * 入栈  思路根据线性表的长度往尾部添加元素
    * */
    public void push(E element) {
        list.add(element);
    }
    /*
    * 删除
    * */
    public E pop() {
        return list.remove(size()-1);
    }

    /*
    * 出栈
    * */
    public E top() {
        return list.get(size()-1);
    }
}
